package cn.taleo.member.mapper;

import cn.taleo.common.mybatis.BaseDao;
import cn.taleo.common.pojo.TaleoResult;
import cn.taleo.common.utils.DateUtils;
import cn.taleo.common.utils.MD5Util;
import cn.taleo.entity.UserDto;
import cn.taleo.member.dao.UserDao;
import lombok.extern.slf4j.Slf4j;

import org.apache.commons.codec.digest.Md5Crypt;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
@Slf4j
public class UserMapperImpl extends TaleoResult implements UserMapper{
    @Autowired
    private UserDao userDao;


    @Override
    public void register(UserDto userDto) {
        userDto.setCreated(DateUtils.getTimestamp());
        userDto.setUpdated(DateUtils.getTimestamp());
        userDto.setPassword(MD5Util.MD5(userDto.getPhone()+userDto.getPassword()));
        userDao.save(userDto,"tb_user");

    }
}
